#ifndef TELEMETRYPARSER_H
#define TELEMETRYPARSER_H

#include <QtCore>

#include "telemetryservcon.h"
#include "inflationdata.h"

using namespace TM;

class QTimer;

class TelemetryParser : public QObject
{
	Q_OBJECT

public:
	TelemetryParser(QObject *parent);
	~TelemetryParser();

private:
	QFile m_fileSource;
	QFileInfo m_fileInfoSource;

	QFile m_fileTarget;
	QFileInfo m_fileInfoTarget;
    QTimer *m_pollTimer;
    QString m_strInFileName,
            m_strOutFileName;

private:
	QMap<int, double> m_sensorMap;//this is the container for the latest data about to goto the file

private slots:
	void update();
public:
	int writeFakeData();
private:
	bool convertToInflationData(const TM_ServCon_Frame& frame, InflationData& inflationData);
	
signals:
	void dataChanged(InflationData inflationData);

private:
	//friend QDataStream & operator>>(QDataStream &s, TM_ServCon_Frame& frame);
	//friend QDataStream & operator<<(QDataStream &s, TM_ServCon_Frame& frame);
	bool isBitSet(const TM_ServCon_Frame& frame, const ServConTypeMask& mask);

//	friend QDataStream & operator>>(QDataStream &s, MSensorBlock& sensorBlock);
//	friend QDataStream & operator>>(QDataStream &s, MTMBlockHeader& header);
//	friend QDataStream & operator>>(QDataStream &s, MTMBlock& block);
//	friend QDataStream & operator<<(QDataStream &s, MSensorBlock& sensorBlock);
//	friend QDataStream & operator<<(QDataStream &s, MTMBlockHeader& header);
//	friend QDataStream & operator<<(QDataStream &s, MTMBlock& block);

};
#endif // TELEMETRYPARSER_H
